<%@page import="java.util.List"%>
<%@page import="com.lei.ajax.entity.UserEntityJson"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<title>Insert title here</title>
<script type="text/javascript" src="ajax.js"></script>
<script type="text/javascript">
function funCheckUserName(isSubmit){
	debugger;
<%--  	Ajax.get('<%=request.getContextPath()%> 
	/UserServlet?userName='
				+ document.getElementById("userName").value, function(
				responseText) {
			var msg = document.getElementById("error");
			if ("exist" == responseText) {
				msg.innerText = "用户名已存在";
				if (isSubmit) {
					alert("用户名已存在");
				}
			} else {
				msg.innerText = "";
				if (isSubmit) {
					document.getElementById("myForm").submit();
				}
			}
		});
	}
</script>--%>
</head>
<body>
	<%
//  		List<UserEntityJson> userNameJson = (List<UserEntityJson>) session.getAttribute(UserConstant.USER_PRESSION);
	%>
	<form action="<%=request.getContextPath()%>/UserServlet" method="post"
		id="myForm">
		用户名：<input type="text" id="userName" onblur="funCheckUserName()"><em
			id="error" style="color: blue"></em>
		<p>

			<!-- id不能命名为submit，否则会有冲突 -->
			<input type="button" id="submit1" value="提交"
				onclick="funCheckUserName(true)">
	</form>
</body>
</html>